//
//  MenuDarenHeader2CollectionReusableView.m
//  Products_B
//
//  Created by lanou on 16/6/4.
//  Copyright © 2016年 朋学友. All rights reserved.
//

#import "MenuDarenHeader2CollectionReusableView.h"

@implementation MenuDarenHeader2CollectionReusableView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 30, 30)];
        self.leftLabel.font = [UIFont systemFontOfSize:13];
        self.leftLabel.text = @"更多";
        
        self.leftLabel.textAlignment = NSTextAlignmentRight;
        [self addSubview:_leftLabel];
    }
    return self;
}
- (void)setModel:(MenuDarenZuoPIngModel *)model{
    _model = model;
    NSLog(@"%@",model.topic_name);
    if (_flag == 0) {
    
    
       
    self.moreButton = [UIButton buttonWithType:(UIButtonTypeSystem)];
    
    self.moreButton.titleLabel.font = [UIFont systemFontOfSize:13];
    [self.moreButton setTintColor:[UIColor orangeColor]];
    
 
    
    self.rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(10 + 30 + 100, 0, 50, 30)];
    self.rightLabel.textAlignment = NSTextAlignmentLeft;
    self.rightLabel.font = [UIFont systemFontOfSize:13];
        
           [self addSubview:_moreButton];
        [self addSubview:_rightLabel];
        
        _flag = 1;
    }
    
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:13] forKey:NSFontAttributeName];
    CGRect bounds = [model.topic_name boundingRectWithSize:CGSizeMake(1000, 30) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    self.moreButton.frame = CGRectMake(10 + 30, 0, bounds.size.width, 30);
    [self.moreButton setTitle:model.topic_name forState:(UIControlStateNormal)];
    
    self.rightLabel.frame = CGRectMake(10 + 30 + bounds.size.width, 0, 50, 30);
    
    self.rightLabel.text = @"的作品";
}
@end
